/**
*File name: view.h
*This file declares the structures and functions of view window.
*\Author: Tran Van Hoang
*\date:09-03-2015
*\Version: $ Reversion:1.0 $
*Contact: tvhoang75@gmail.com
*/

#ifndef VIEW_H
#define VIEW_H
#include "cellNetwork.h"
#include <Xlib.h>

typedef struct{
	int thresholdValue;
	unsigned long color;
}ColorMap;

//Declaring table color
#define NUM_COLOR 8
#define GRAY1 136*136*136
#define GRAY2 88*88*88
#define BLACK1 56*56*56
#define BLACK2 8*8*8
#define ORANGE1 16763955
#define ORANGE2 16777011
#define RED1 9437184
#define RED2 16711680

typedef struct cachedImage {
	int index; // index in original data
        	CellPosition position;
        	XImage *image;
        	int *mapPosToIndex;
}cachedImage;

#define COLOR_FIRED 16729344
#define COLOR_ASH 8421504
#define COLOR_EMPTY 16119260

#define COLOR_URGENT 16711680

#define COLOR_BACKGROUND 16119260
//cachedImage imageCache[nbCells];

//int *mapPosToIndex;

void maxPos(CellPosition position, CellPosition *maxPosition);


/**************View functions**********************/

extern void showCellNetwork(CellArray  myCell, Display *display, Colormap colormap, Window win, GC gc, int plotSize, int state, int range_sensing, int range_communication);

extern void showCellForest(CellArray  myCell, Display *display, Colormap colormap, Window win, GC gc, int plotSize, int state);

extern void showCellInsect(CellArray  myCell, Display *display, Colormap colormap, Window win, GC gc, int plotSize, int nb_insects);

extern void showCellDensity(CellArray  myCell, Display *display, Colormap colormap, Window win, GC gc, int plotSize, int density);

extern void showCell(CellArray  myCell, Display *display, Colormap colormap, Window win, GC gc, int plotSize, long cellColor);

extern void showCells(CellArray  *myCells, Display *display, Colormap colormap, Window win, GC gc, int plotSize, int *state, int node_number);

#endif
